<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>HTTP请求</title>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<form action="http://127.0.0.1:8080" method="post">
    用户名:<input name="name"><br>
    密码:<input name="pwd"><br>
    <button>登录</button>
</form>
<hr>
<form action="http://localhost/hello.s" method="post" enctype="multipart/form-data">
    用户名:<input name="name"><br>
    密码:<input name="pwd"><br>
    头像:<input name="file" type="file"><br>
    <button>注册</button>
</form>
<hr>
<button onclick="get()">axios.get</button>
<button onclick="post1()">axios.post1</button>
<button onclick="post2()">axios.post2</button>

<script>
    function get(){
        axios.get("http://127.0.0.1:8080",{
            params:{
                name:"root",
                pwd:"123"
            }
        });
    }

    function post1(){
        let p = new URLSearchParams();
        p.append("name","root");
        p.append("pwd","456");
        axios.post("http://127.0.0.1:8080",p);
    }

    function post2(){
        let params = {
            name:"root",
            pwd:"789"
        }
        axios.post("http://127.0.0.1:8080",params)
    }

</script>
</html>